{{include file="public/header" /}}
 
<!-- right content start  -->
<div class="content-right">
    <div class="content">
        <!-- form start -->
           <legend>
                <span class="fs-16">
                    {{if empty($data['id'])}}
                    商品添加
                    {{else /}}
                    商品编辑
                    {{/if}}
                </span>
             <a href="javascript:window.history.back();" class="fr fs-14 m-t-5 am-icon-mail-reply"> 返回</a>
                
            </legend>
          <legend>
                <span class="fs-12"> 
                    请根据商品类型，选择添加方式
                    
                </span>
               
            </legend>
         <legend>
                <span  style="font-size:22px;"> 
                    扫码枪上书  <input type="text"  name="code"  style="height:40px; font-size:16px;"  value="" placeholder="请扫描书后条形码">  
           
                   &nbsp; &nbsp; &nbsp; &nbsp; 查询上书  <input type="text"   name="isbn" style="height:40px; font-size:16px;" value=""  placeholder="请输入isbn编号">  
                </span> 
               <button type="submit" class="am-btn  am-radius am-btn-primary " data-am-loading="{loadingText:'处理中...'}">搜索</button>
                    
            </legend>
           <form class="am-form form-validation view-save" action="{{:MyUrl('admin/goods/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/goods/saveinfo')}}" enctype="multipart/form-data">
      
 

            <!-- 基础信息 -->
            <div id="goods-nav-base" class="division-block">
                <label class="block nav-detail-title">基础信息</label>
                <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>书名</label>
                    <div class="am-input-group am-input-group-sm" style="display: -webkit-inline-box;width:80%">
                       
                        <input   type="text" name="title" placeholder="标题名称" minlength="2" maxlength="60" data-validation-message="书名格式 2~60 个字符" class="am-form-field am-radius" {{if !empty($data)}} value="{{$data.title}}" {{/if}} {{if !empty($data['title_color'])}} style="color:{{$data.title_color}};" {{/if}} required />
                               <span class="am-input-group-btn">
                               <button class="am-btn am-btn-default am-btn-xs colorpicker-submit" type="button" data-input-tag="input[name='title']" data-color-tag="input[name='title_color']">
                                <img src="{{$attachment_host}}/static/common/images/colorpicker.png" />
                            </button>
                        </span>
                    </div>
                </div>
                  <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>作者<span class="am-form-group-label-tips"></span></label>
                    <input type="text"  style="display: -webkit-inline-box;width:80%" name="author" placeholder="作者"   class="am-radius" value="{{if empty($data)}}{{else /}}{{$data.author}}{{/if}}" required />
                </div>
                  <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>出版社</label>
                    
                 
                    
                    <input type="text"  style="display: -webkit-inline-box;width:40%" name="press" placeholder="出版社"   class="am-radius" value="{{if empty($data)}}{{else /}}{{$data.press}}{{/if}}" required />
                </div>
                    <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>出版时间</label>
                    <div style="display:inline-flex;width:80%" >
                    
                    <input type="radio" name="pubdate" class="pubdate" value="2" {{if !empty($data['years'])}}checked{{/if}}>选择年代&nbsp;&nbsp;
                    <input type="radio" name="pubdate" class="pubdate" value="1" {{if !empty($data['pubdate'])}}checked{{/if}}>填写时间&nbsp;&nbsp;<br/>
                        <div id="niandai" style="{{if empty($data['pubdate']) && !empty($data['years'])}} display:none; {{/if}}    width: 330px;">
                        <select name="niandai_pubdate"  class="am-radius chosen-select" minchecked="1" data-placeholder="请选择..." data-validation-message="请选择出版时间" required > 
                            {{if !empty($pubDate)}}
                            {{foreach $pubDate as $k=>$v}}
                            <option value="{{$k}}"  {{if !empty($data['pubdate']) and ( $k== $data['years'])}}selected{{/if}}>一级 - {{$k}}</option>
                            {{if !empty($v)}}
                            {{foreach $v as $kk=>$vs}}  
                            <option style="padding-left: 30px;" value="{{$vs}}" {{if !empty($data['years']) and ($vs== $data['years'])}}selected{{/if}}  >二级-{{$vs}}</option>
                            {{/foreach}}
                            {{/if}}
                            {{/foreach}}
                            {{/if}}
                        </select>
                        </div>
                        
                        <div id="time"  style="{{if !empty($data['pubdate']) && empty($data['years'])}} display:none; {{/if}} ">
                             <input style="display:unset;width:60px" value="{{if !empty($data)}}{{$data['pubdate'][0]}}{{/if}}" type="text" name="time_year" />年 &nbsp;&nbsp;  <input style="display:unset;width:60px" value="{{if !empty($data)}}{{$data['pubdate'][1]}}{{/if}}" type="text" name="time_month" />月&nbsp; &nbsp;  第<input value="{{if !empty($data)}}{{$data['pubdate'][2]}}{{/if}}" style="display:unset;width:60px" type="text" name="time_num" />版
                              </div>
                    </div>
                </div>
                     <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>装帧</label>
                    <input type="radio" name="binding" value="1" {{if !empty($data['binding']) and $data['binding']==1}}checked{{/if}}>平装&nbsp;&nbsp;
                    <input type="radio" name="binding" value="2" {{if !empty($data['binding']) and $data['binding']==2}}checked{{/if}}>精装&nbsp;&nbsp;
                    <input type="radio" name="binding" value="3" {{if !empty($data['binding']) and $data['binding']==3}}checked{{/if}}>软精装&nbsp;&nbsp;
                    <input type="radio" name="binding" value="4" {{if !empty($data['binding']) and $data['binding']==4}}checked{{/if}}>线装&nbsp;&nbsp;   
                    <input type="radio" name="binding" value="5" {{if !empty($data['binding']) and $data['binding']==5}}checked{{/if}}>其他&nbsp;&nbsp;   
                </div> 
                <div class="am-form-group">
                    <div>
                        <label><span class="am-form-group-label-tips" style="color:red">*</span>货架号</label>
                        <input type="text" name="shelf_number"  style="display: -webkit-inline-box;width:80%" placeholder="货架号" maxlength="30" data-validation-message="货架号格式 最多15个字符" class="am-radius" {{if !empty($data)}} value="{{$data.shelf_number}}" {{elseif !empty($session_shelf_number)}} value="{{$session_shelf_number}}" {{/if}} required/>
                    </div> 
                </div>    
                  
                  <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>商品分类</label>
                    
                    <select  style="display: -webkit-inline-box;width:80%" name="category_id" class="am-radius chosen-select" multiple="multiple" minchecked="1" data-placeholder="请选择..." data-validation-message="请至少选择一个商品分类" required>
                        {{if !empty($goods_category_list)}}
                        {{foreach $goods_category_list as $v}}
                        <option value="{{$v.id}}" {{if !empty($data['category_ids']) and in_array($v['id'], $data['category_ids'])}}selected{{/if}}>一级 - {{$v.name}}</option>
                        {{if !empty($v['items'])}}
                        {{foreach $v.items as $vs}}
                        <option style="padding-left: 30px;" value="{{$vs.id}}" {{if !empty($data['category_ids']) and in_array($vs['id'], $data['category_ids'])}}selected{{/if}}>二级-{{$vs.name}}</option>
                        {{if !empty($vs['items'])}}
                        {{foreach $vs.items as $vss}}
                        <option style="padding-left: 60px;" value="{{$vss.id}}" {{if !empty($data['category_ids']) and in_array($vss['id'], $data['category_ids'])}}selected{{/if}}>三级-{{$vss.name}}</option>
                       
                         
                        
                        {{/foreach}}    
                        {{/if}}
                        {{/foreach}}
                        {{/if}}
                        {{/foreach}}
                        {{/if}}
                    </select>
                </div>
                 <div class="am-form-group">
                    <label><span class="am-form-group-label-tips" style="color:red">*</span>品相</label>
                     <div style="display:inline-block;width:80%" >
                    <select name="quality" class="am-radius chosen-select"   data-placeholder="可选择..." data-validation-message="请选择品相信息" required>
                        <option value="">可选择...</option>
                        {{if !empty($quality)}}
                        {{foreach $quality as $k=>$v}}
                        
                        <option style="padding-left: 30px;" value="{{$k}}" {{if !empty($data['quality']) and $data['quality']==$k}}selected{{/if}}>{{$v}}</option>

                        {{/foreach}}
                        {{/if}}
                    </select>
                     </div>
                </div>
                 <div class="am-form-group">
                    <label>品相描述</label>
                     <div style="display:inline-block;width:80%" >
                         <textarea name="phase" width="80%" height="40px"> {{if empty($data)}}{{else /}}{{$data.phase}}{{/if}} </textarea>
                     </div>
                </div>
                 <!-- 规格 -->
                <div id="goods-nav-operations" class="division-block" data-spec-add-max-number="{{:MyC('common_spec_add_max_number', 3, true)}}">
                    <label class="block nav-detail-title">商品规格</label>
                    <!-- <span class="business-operations-submit specifications-nav-title-add">+添加规格</span>-->
                    <div class="goods-specifications">
                        <table class="am-table am-table-bordered am-table-centered specifications-table m-t-10 m-b-10">
                            <thead class="title-nav">
                                <tr>


                                    <th class="title-start"><span class="am-form-group-label-tips" style="color:red">*</span>售价(元)</th>
                                    <th><span class="am-form-group-label-tips" style="color:red">*</span>库存数量</th>


                                    <th>重量（kg）</th>

                                    <th>原定价(元)</th>

                                </tr>
                            </thead>
                            <tbody>
                                  {{if empty($specifications['value'])}}
                                <tr class="line-0" data-line-tag=".line-0">
                                    <td class="value-start">
                                        <input type="number" name="specifications_price[]" placeholder="价格" class="am-radius"  min="1" max="100000000"  pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效售价"   required />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_inventory[]" placeholder="库存"  value="1"    class="am-radius" min="1" max="100000000" pattern="^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$" data-validation-message="库存数量 1~10000" required />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_weight[]" placeholder="重量"   class="am-radius"   min="0" max="100000000"   />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_original_price[]" placeholder="原价"   class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的原价" />
                                    </td>
                                </tr>
                                  {{/if}}
                                  
                            {{if !empty($specifications['value'])}}
                            {{foreach $specifications.value as $line_k=>$line_v}}
                                          <tr class="line-{{$line_k}} {{if $line_k gt 0}} line-not-first{{/if}}" data-line-tag=".line-{{$line_k}}">
                                {{foreach $line_v as $v}}
                                {{if isset($v['data_type'])}}
                               
                               
                                    <td class="value-start">
                                        <input type="number" name="specifications_price[]" placeholder="价格" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" data-validation-message="请填写有效的售价"  value="{{$v.data.price}}" required />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_inventory[]" placeholder="库存"  value="{{$v.data.inventory}}" class="am-radius" min="1" max="10000" pattern="^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$"   required />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_weight[]" placeholder="重量" value="{{if $v['data']['weight'] gt 0}}{{$v.data.weight}}{{/if}}" class="am-radius" min="0" max="100000000" step="0.01"  />
                                    </td>
                                    <td>
                                        <input type="number" name="specifications_original_price[]" placeholder="原价" maxlength="10" value="{{if $v['data']['original_price'] gt 0}}{{$v.data.original_price}}{{/if}}" class="am-radius" pattern="^([0-9]{1}\d{0,6})(\.\d{1,2})?$" />
                                    </td>
                                       
                                {{/if}}
                                {{/foreach}}
                            </tr>
                             {{/foreach}}
                            {{/if}}
                            </tbody>
                        </table>
                       
                  
                          <!-- 相册 -->
                    <div id="goods-nav-photo" class="division-block">
                        <label class="block nav-detail-title"><span class="am-form-group-label-tips" style="color:red">*</span>商品相册<span class="am-form-group-label-tips">可拖拽图片进行排序，建议图片尺寸一致</span></label>
                        <ul class="plug-file-upload-view goods-photo-view" data-form-name="photo[]" data-max-number="30" data-dialog-type="images">
                            {{if !empty($data['photo'])}}
                            {{foreach $data.photo as $v}}
                            <li>
                                <input type="text" name="photo[]" value="{{$v.images_old}}" />
                                <img src="{{$v.images}}" />
                                <i>×</i>
                            </li>
                            {{/foreach}}
                            {{/if}}
                        </ul>
                        <div class="plug-file-upload-submit" data-view-tag="ul.goods-photo-view">+上传相册</div>
                    </div>
                <div class="am-form-group">
                    <label>推荐语</label>
                    <input type="text" style="display: -webkit-inline-box;width:80%" name="simple_desc" placeholder="推荐语" maxlength="160" data-validation-message="推荐语格式 最多160个字符" class="am-radius" {{if !empty($data)}} value="{{$data.simple_desc}}"{{/if}} />


                </div>
              
              
                <div class="am-form-group">
                    <label>所属仓库</label>
                    <select  style="display: -webkit-inline-box;width:80%"  name="warehouse_id" class="am-radius chosen-select"   >
                        
                        {{if !empty($warehouse_list)}}
                        {{foreach $warehouse_list as $k=>$v}}
                                    
                                 <option style="padding-left: 30px;" value="{{$v['id']}}" {{if !empty($data) and  $v['id'] ==$data.wid}}selected{{/if}}>{{$v.warehouse_name}}</option>
                                 
                        {{/foreach}}
                        {{/if}}
                    </select>
                </div>
                <div class="am-form-group" >
                    <label>ISBN<span class="am-form-group-label-tips"></span></label>
                    <input  type="text"  style="display: -webkit-inline-box;width:80%" name="isbn" placeholder="ISBN"   class="am-radius" value="{{if empty($data)}}{{else /}}{{$data.isbn}}{{/if}}"  />
                </div>
              
                <div class="am-form-group">
                    <label>印数<span class="am-form-group-label-tips"></span></label>
                    <input type="text"  style="display: -webkit-inline-box;width:80%" name="impression" placeholder="印数"   class="am-radius" value="{{if empty($data)}}{{else /}}{{$data.impression}}{{/if}}"  />
                </div>
                <div class="am-form-group">
                    <label>页数<span class="am-form-group-label-tips"></span></label>
                    <input type="text"  style="display: -webkit-inline-box;width:80%" name="number" placeholder="页数"   class="am-radius" value="{{if empty($data)}}{{else /}}{{$data.number}}{{/if}}"  />
                </div>
               
              
            
                <div class="am-form-group">
                    <label>印刷时间<span class="am-form-group-label-tips"></span></label>
                      <input type="text"  style="display: -webkit-inline-box;width:80%" name="publishingdate" class="am-radius Wdate" placeholder="印刷时间" pattern="{{:lang('common_regex_date')}}" data-validation-message="印刷时间格式有误" {{if !empty($data)}} value="{{$data.publishingdate}}" {{/if}} onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" />
			
                </div>

           


                <div class="am-form-group">
                    <label>开本</label>
                     <div >
                    <select name="openbook"    class="am-radius chosen-select" data-placeholder="可选择..." data-validation-message="请选择开本信息">
                        <option value="">可选择...</option>
                        {{if !empty($openBook)}}
                        {{foreach $openBook as $k=>$v}}

                        <option  value="{{$v}}"  {{if !empty($data['openbook']) and $data['openbook']==$v}}selected{{/if}}>{{$v}}</option>

                        {{/foreach}}
                        {{/if}}
                    </select>
                     </div>
                </div>
                
               
                <div class="am-form-group">
                    <label>纸张<span class="am-form-group-label-tips"></span></label>
                    <input type="radio" name="paperypte" value="1" {{if !empty($data['paperypte']) and $data['paperypte']==1}}checked{{/if}}>胶版纸&nbsp;&nbsp;
                    <input type="radio" name="paperypte" value="2" {{if !empty($data['paperypte']) and $data['paperypte']==2}}checked{{/if}}>铜版纸&nbsp;&nbsp;
                    <input type="radio" name="paperypte" value="3" {{if !empty($data['paperypte']) and $data['paperypte']==3}}checked{{/if}}>轻型纸&nbsp;&nbsp;
                    <input type="radio" name="paperypte" value="4" {{if !empty($data['paperypte']) and $data['paperypte']==4}}checked{{/if}}>纯质纸&nbsp;&nbsp;   
                    <input type="radio" name="paperypte" value="5" {{if !empty($data['paperypte']) and $data['paperypte']==5}}checked{{/if}}>其他&nbsp;&nbsp;   
                </div> 
             
               <!--
                        <div class="am-form-group am-form-file">
                            <label class="block">首页推荐图片<span class="am-form-group-label-tips">留空则取相册第一张图</span></label>
                            <ul class="plug-file-upload-view goods-recommended-images-view" data-form-name="home_recommended_images" data-max-number="1" data-dialog-type="images">
                                {{if !empty($data['home_recommended_images'])}}
                                <li>
                                    <input type="text" name="home_recommended_images" value="{{$data.home_recommended_images}}" />
                                    <img src="{{$data.home_recommended_images}}" />
                                    <i>×</i>
                                </li>
                                {{/if}}
                            </ul>
                            <div class="plug-file-upload-submit" data-view-tag="ul.goods-recommended-images-view">+上传图片</div>
                        </div>
                        <div class="am-form-group">
                            <label class="block">扣减库存<span class="am-form-group-label-tips">扣除规则根据后台配置->扣除库存规则而定</span></label>
                            <input name="is_deduction_inventory" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['is_deduction_inventory']) and $data['is_deduction_inventory'] eq 1) or empty($data)}}checked="true"{{/if}} />
                        </div>
                        <div class="am-form-group">
                            <label class="block">上下架<span class="am-form-group-label-tips">下架后用户不可见</span></label>
                            <input name="is_shelves" value="1" type="checkbox" data-off-text="下架" data-on-text="上架" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['is_shelves']) and $data['is_shelves'] eq 1) or empty($data)}}checked="true"{{/if}} />
                        </div>
                        <div class="am-form-group">
                            <label class="block">首页推荐<span class="am-form-group-label-tips">推荐后在首页展示</span></label>
                            <input name="is_home_recommended" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['is_home_recommended']) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
                        </div>
                        
                        <div class="am-form-group">
                            <label class="block">最新上架</label>
                            <input name="new_upper" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['new_upper']) and $data['new_upper'] eq 1) or empty($data)}}checked="true"{{/if}} />
                        </div>
                        <div class="am-form-group">
                            <label class="block">每日推荐</label>
                            <input name="recommended_daily" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if (isset($data['recommended_daily']) and $data['recommended_daily'] eq 1) or empty($data)}}checked="true"{{/if}} />
                        </div>
                        <div class="am-form-group">
                            <label class="block">珍品孤本</label>
                            <input name="rare_treasures" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if isset($data['rare_treasures']) and $data['rare_treasures'] eq 1}}checked="true"{{/if}} />
                        </div>
                    </div>

                  

                 
                    <div id="goods-nav-video" class="division-block">
                        <label class="block nav-detail-title">商品视频</label>
                        <div class="am-form-group am-form-file">
                            <label class="block">短视频<span class="am-form-group-label-tips">视频比图文更有具带入感，仅支持 mp4 格式</span></label>
                            <ul class="plug-file-upload-view plug-file-upload-view-video goods-video-view" data-form-name="video" data-max-number="1" data-dialog-type="video">
                                {{if !empty($data['video'])}}
                                <li>
                                    <input type="text" name="video" value="{{$data.video}}" />
                                    <video src="{{$data.video}}" controls>your browser does not support the video tag</video>
                                    <i>×</i>
                                </li>
                                {{/if}}
                            </ul>
                            <div class="plug-file-upload-submit" data-view-tag="ul.goods-video-view">+上传视频</div>
                        </div>
                    </div>
                 
                  
                    <div id="goods-nav-app" class="division-block">
                        <label class="block nav-detail-title">手机端详情</label>
                        <ul class="content-app-items" data-max-count="10" data-required="1" data-images-name="content_app_images" data-content-name="content_app_text" data-images-text="图片" data-content-text="文本内容" data-delete-text="删除" data-drag-sort-text="拖拽排序">
                            {{if !empty($data['content_app'])}}
                            {{foreach $data.content_app as $v}}
                            <li>
                                <div>
                                    <div class="content-app-left">
                                        <label class="block">图片</label>
                                        <ul class="plug-file-upload-view goods-content-app-images-view-{{$v.id}}" data-form-name="content_app_images_{{$v.id}}" data-max-number="1" data-dialog-type="images">
                                            {{if !empty($v['images'])}}
                                            <li>
                                                <input type="text" name="content_app_images_{{$v.id}}" value="{{$v.images_old}}" />
                                                <img src="{{$v.images}}" />
                                                <i>×</i>
                                            </li>
                                            {{/if}}
                                        </ul>
                                        <div class="plug-file-upload-submit" data-view-tag="ul.goods-content-app-images-view-{{$v.id}}">+上传图片</div>
                                    </div>
                                    <div class="am-form-group content-app-right fr">
                                        <label>文本内容</label>
                                        <textarea rows="5" name="content_app_text_{{$v.id}}" maxlength="105000" class="am-radius" placeholder="文本内容" data-validation-message="文本内容最多 105000 个字符">{{if !empty($v)}}{{$v.content_old|raw}}{{/if}}</textarea>
                                    </div>
                                </div>
                                <i class="c-p fs-12 cr-red content-app-items-rem-sub">删除</i>
                                <i class="c-m fs-12 drag-sort-submit">拖拽排序</i>
                            </li>
                            {{/foreach}}
                            {{/if}}
                        </ul>
                        <span class="business-operations-submit content-app-items-add-sub">+添加手机详情</span>
                    </div>

                   
                    <div id="goods-nav-web" class="division-block">
                        <label class="block nav-detail-title">电脑端详情</label>
                        <div class="am-form-group">
                            <textarea class="am-radius am-validate" name="content_web" maxlength="105000" id="editor-tag" data-validation-message="电脑端详情内容最多 105000 个字符">{{if !empty($data)}}{{$data.content_web}}{{/if}}</textarea>
                        </div>
                    </div>
 
                    <div id="goods-nav-extends" class="division-block">
                        <label class="block nav-detail-title">扩展数据<span class="am-form-group-label-tips-must">该区域为插件扩展数据，请按照插件文档填写相应的值</span></label>
                         插件扩展数据 start  
                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                        <div class="plugins-tag">
                            <span>plugins_view_admin_goods_save</span>
                        </div>
                        {{/if}}
                        {{if !empty($plugins_view_admin_goods_save_data) and is_array($plugins_view_admin_goods_save_data)}}
                        {{foreach $plugins_view_admin_goods_save_data as $hook}}
                        {{if is_string($hook) or is_int($hook)}}
                        {{$hook|raw}}
                        {{/if}}
                        {{/foreach}}
                        {{else /}}
                        <div class="table-no"><i class="am-icon-warning"></i> 没有扩展数据</div>
                        {{/if}}
                       
                    </div>
 
            
                    <div id="goods-nav-seo" class="division-block">
                        <label class="block nav-detail-title">SEO</label>
                        {{include file="lib/seo" /}}
                    </div>
   -->
                    <div class="am-form-group am-form-group-refreshing">
                        <input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
                               <button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
                    </div>
                    </form>
                  
                </div>
            </div>
               
            <!-- right content end  -->

            <!-- 规格扩展数据弹层 -->
            <div class="am-popup" id="specifications-extends-popup">
                <div class="am-popup-inner">
                    <div class="am-popup-hd">
                        <h4 class="am-popup-title">规格扩展数据</h4>
                        <span data-am-modal-close class="am-close">&times;</span>
                    </div>
                    <div class="am-popup-bd">
                        <form class="am-form form-validation-specifications-extends view-save" request-type="sync" request-value="SpecificationsExtendsBack">
                            {{if !empty($goods_specifications_extends) and is_array($goods_specifications_extends)}}
                            {{foreach $goods_specifications_extends as $v}}
                            <div class="am-alert am-alert-secondary">
                                <label class="am-text-sm">{{$v.name}}</label>
                                {{if !empty($v['desc'])}}
                                <span class="am-text-xs am-text-warning am-margin-left-xs">{{$v.desc}}</span>
                                {{/if}}
                                {{if !empty($v['element'])}}
                                {{foreach $v.element as $element}}
                                <div class="am-form-group">
                                    <label class="block">{{$element.title}}{{if !empty($element['desc'])}}<span class="am-form-group-label-tips">{{$element.desc}}</span>{{/if}}</label>
                                    {{switch element.element}}
                                    {{case input}}
                                    {{if in_array($element['type'], ['radio', 'checkbox']) and !empty($element['element_data']) and is_array($element['element_data'])}}
                                    {{foreach $element.element_data as $element_data_key=>$element_data}}
                                    <label class="{{if isset($element['is_block']) and $element['is_block'] eq 1}}am-{{$element.type}}{{else /}}am-{{$element.type}}-inline{{/if}}">
                                        <input
                                            type="{{$element.type}}"
                                            name="{{$element.name}}"
                                            value="{{$element_data.value}}"

                                            {{if isset($data['config'][$element['name']]) and in_array($element_data['value'], explode(',', $data['config'][$element['name']]))}} checked{{/if}}

                                            {{if isset($element['minchecked']) and $element['type'] eq 'checkbox'}} minchecked="{{$element.minchecked}}"{{/if}}

                                            {{if isset($element['maxchecked']) and $element['type'] eq 'checkbox'}} maxchecked="{{$element.maxchecked}}"{{/if}}

                                            {{if isset($element['message'])}} data-validation-message="{{$element.message}}"{{/if}}

                                            {{if $element_data_key eq 0 and isset($element['is_required']) and $element['is_required'] eq 1}}required{{/if}}
                                            data-am-ucheck />
                                            {{$element_data.name}}
                                    </label>
                                    {{/foreach}}
                                    {{else /}}
                                    <input
                                        class="am-radius"
                                        type="{{$element.type}}"
                                        name="{{$element.name}}"
                                        value="{{if isset($data['config'][$element['name']])}}{{$data['config'][$element['name']]}}{{else /}}{{if isset($element['default'])}}{{$element.default}}{{/if}}{{/if}}"

                                        {{if isset($element['placeholder'])}} placeholder="{{$element.placeholder}}"{{/if}}

                                        {{if isset($element['message'])}} data-validation-message="{{$element.message}}"{{/if}}

                                        {{if isset($element['is_required']) and $element['is_required'] eq 1}} required{{/if}}
                                        />
                                        {{/if}}
                                        {{/case}}
                                        {{case select}}
                                        {{if !empty($element['element_data']) and is_array($element['element_data'])}}
                                        <select
                                        class="chosen-select am-radius"
                                        name="{{$element.name}}"

                                        {{if isset($element['message'])}} data-validation-message="{{$element.message}}"{{/if}}

                                        {{if !empty($element['placeholder'])}} data-placeholder="{{$element.placeholder}}"{{/if}}

                                        {{if isset($element['is_multiple']) and $element['is_multiple'] eq 1}}
                                        multiple
                                        {{if isset($element['minchecked'])}} minchecked="{{$element.minchecked}}"{{/if}}
                                        {{if isset($element['maxchecked'])}} maxchecked="{{$element.maxchecked}}"{{/if}}
                                        {{/if}}

                                        {{if isset($element['is_required']) and $element['is_required'] eq 1}}required{{/if}}
                                        >
                                        {{if !isset($element['is_multiple']) or $element['is_multiple'] neq 1}}
                                        {{if !empty($element['placeholder'])}}
                                        <option value="">{{$element.placeholder}}</option>
                                        {{/if}}
                                        {{/if}}
                                        {{foreach $element.element_data as $element_data_key=>$element_data}}
                                        <option
                                            value="{{$element_data.value}}"
                                            {{if isset($data['config'][$element['name']]) and in_array($element_data['value'], explode(',', $data['config'][$element['name']]))}}selected{{/if}}
                                            >{{$element_data.name}}</option>
                                        {{/foreach}}
                                    </select>
                                    {{/if}}
                                    {{/case}}
                                    {{case textarea}}
                                    <textarea
                                        class="am-radius"
                                        name="{{$element.name}}"

                                        {{if isset($element['rows'])}} rows="{{$element.rows}}"{{/if}}

                                        {{if isset($element['placeholder'])}} placeholder="{{$element.placeholder}}"{{/if}}

                                        {{if isset($element['is_required']) and $element['is_required'] eq 1}}
                                        {{if isset($element['minlength'])}} minlength="{{$element.minlength}}"{{/if}}
                                        {{if isset($element['maxlength'])}} maxlength="{{$element.maxlength}}"{{/if}}
                                        required
                                        {{/if}}
                                        >{{if isset($data['config'][$element['name']])}}{{$data['config'][$element['name']]}}{{else /}}{{if isset($element['default'])}}{{$element.default}}{{/if}}{{/if}}</textarea>
                                    {{/case}}
                                    {{/switch}}
                                </div>
                                {{/foreach}}
                                {{/if}}
                            </div>
                            {{/foreach}}

                            <div class="am-form-group am-form-group-refreshing">
                                <button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block">确认</button>
                            </div>
                            {{else /}}
                            <div class="table-no"><i class="am-icon-warning"></i> 没有扩展数据</div>
                            {{/if}}
                        </form>
                    </div>
                </div>
            </div>

            <!-- footer start -->
            {{include file="public/footer" /}}
            <!-- footer end -->

            <!-- 拖拽排序初始化 -->
            <script type="text/javascript">
                    $(".pubdate").click(function () {
                        
                    
                        if($(this).val() ==1)
                        {
                             $("#time").show();
                               $("#niandai").hide();
                             
                        }
                        else  if($(this).val() ==2){
                             $("#niandai").show();

                            $("#time").hide();
                        }
                    });
                // 规格扩展返回处理
                function SpecificationsExtendsBack()
                {
                    var $extends_popup = $('#specifications-extends-popup');
                    var data = GetFormVal('#specifications-extends-popup', true);
                    $('.specifications-table').find($extends_popup.attr('data-line-extend')).find('.line-extend-input').val(JSON.stringify(data));
                    $extends_popup.modal('close');
                }
            </script>